#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>

using namespace std;

string countAndSay(int n) {
    string ret = "1";
    for (int i = 1; i < n; ++i)
    {
        string temp;
        int len = ret.size();
        for (int right = 0, left = 0; right < len; )
        {
            while (right < len && ret[right] == ret[left])
                right++;
            temp += to_string(right - left) + ret[left];
            left = right;
        }

        ret = temp;
    }

    return ret;
}
int main()
{
    countAndSay(4);
	return 0;
}